package com.atguigu.yygh.task.schedule;

import com.atguigu.yygh.rabbit.constaner.MqConst;
import com.atguigu.yygh.rabbit.service.MqService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author luoyin
 * @Date 20:41 2022/10/11
 **/
@Component
@EnableScheduling
public class ScheduledTask {
    @Autowired
    private MqService mqService;

    //@Scheduled(cron = "0 0 8 * * ?")
    //尊敬的用户${name}:你好,你在${title}预约了${reserveDate}的挂号,请你按时过来.谢谢!
    @Scheduled(cron = "0/50 * * * * ?")
    public void sendMessage(){
        mqService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK,"");
    }
}
